import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [{
    path: '/',
    name: 'Home',
    component: Home,
    meta:{title:"网易云"},
    children: [{
        // 发现首页
        path: '',
        name: 'findmusic',
        component: () => import( /* webpackChunkName: "about" */ '../views/Findmusic.vue'),
        meta:{title:"首页"},
        children: [{
            //轮播图界面
            path: '',
            name: 'index',
            component: () => import( /* webpackChunkName: "about" */ '../views/son/Lbt.vue'),
            meta:{title:"首页"}
          },
          {
            //专属定制
            path: 'exclusive',
            name: 'exclusive',
            component: () => import( /* webpackChunkName: "about" */ '../views/son/Exclusive.vue'),
            meta:{title:"定制页面"}
          },
          {
            //歌单
            path: 'playlist',
            name: 'playlist',
            component: () => import( /* webpackChunkName: "about" */ '../views/son/Playlist.vue'),
            meta:{title:"歌单"}
          },
          {
            //排行
            path: 'ranking',
            name: 'ranking',
            component: () => import( /* webpackChunkName: "about" */ '../views/son/Ranking.vue'),
            meta:{title:"排行"}
          },
          {
            //歌手
            path: 'singer',
            name: 'singer',
            component: () => import( /* webpackChunkName: "about" */ '../views/son/Singer.vue'),
            meta:{title:"歌手"}
          },
          {
            //最新音乐
            path: 'upmusic',
            name: 'upmusic',
            component: () => import( /* webpackChunkName: "about" */ '../views/son/Upmusic.vue'),
            meta:{title:"最新音乐"}
          },


        ]
      },
      {
        //热门歌手的推荐
        path: '/musicpage',
        name: 'musicpage',
        component: () => import( /* webpackChunkName: "about" */ '../views/page/musicpage.vue'),
        meta:{title:"热门歌手推荐"}
      }
    ]
  },
  {
    path: '/about',
    name: 'About',
    component: () => import( /* webpackChunkName: "about" */ '../views/About.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import( /* webpackChunkName: "about" */ '../views/Login.vue')
  },

]



const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
router.beforeEach((to,form,next)=>{
  form
  document.title=to.meta.title
  next()

})
export default router